package com.example.springbootdemo.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springbootdemo.mapper.UserMapper;
import com.example.springbootdemo.entity.User;
import com.example.springbootdemo.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Resource
    UserMapper userMapper;
    @Override
    public User login(User user) {
        return userMapper.selectOne(Wrappers.lambdaQuery(user).eq(User::getUsername,user.getUsername()).eq(User::getPassword,user.getPassword()));
    }

    @Override
    public List<User> getUserList() {
        return userMapper.selectList(null);
    }
}


